#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
	int k;
	cin>>k;
	while(k--)
	{
		int n;
		cin>>n;
		int flag = 0;
		for(int i = n;i+82>=n;i--)
		{
			int sum = i;
			int t = i;
			while(t)
			{
				sum += (t%10);
				t=t/10;
			}
			if(sum==n) 
			{
				flag = 1;
				cout<<"No"<<endl;
				break;
			}
		}
		if(flag==0) cout<<"Yes"<<endl;
	}
}
